home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Libraries
/
VideoToolbox 96.06.15
/
VideoToolboxSources
/
SetMouse.c
< prev
next >
Wrap
Text File
|
1995-10-06
|
2KB
|
58 lines
/*
SetMouse.c
Sets the mouse location to the given point, which is specified in the local
coordinate system of the current port.
WARNING: In the Q & A Stack, Apple tells you how to do this, but warns that the
technique uses undocumented low-memory locations that are considered unsupported
and volatile and may change in future CPUs.
WARNING: According to a note from Apple, this may not work on certain 680x0 Macs,
e.g. the Centris. (I don't know whether it works on PowerMacs; I would guess that it
does work.) Apple has issued preliminary documentation of a Cursor Device Manager
that eventually will support all Macs. See MoveMouse.c in VideoToolboxSources.
From "Code gadgets: Setting the mouse location", THINKin' CaP, 1(2):28-29, Fall 1990.
Copyright © 1991 SPLAsh Resources. All rights reserved. This source code is
copyrighted, but free. This means that programmers may use the code and
incorporate it into their own programs (commercial or otherwise) without payment
of any fees. However, the source code itself may not be sold or distributed on
electronic bulletin board services without written permission from SPLAsh
Resources.
SPLAsh Resources
1678 Shattuck Ave #302
Berkeley, CA 94709
(415) 527-0122
HISTORY:
2/25/91 dgp added to VideoToolbox
8/24/91 dgp Made compatible with THINK C 5.0.
5/28/94 dgp Eliminated use of SysEqu.h, for compatibility with Apple's Universal Headers.
10/5/95 dgp converted the specification of the low-memory globals from the old nonstandard
Mac notation (e.g. Point MTemp:0x828;) to standard C. Bosco Tjan reported
that the Symantec PPC C 8 compiler won't accept the old nonstandard syntax.
*/
#include "VideoToolbox.h"
/* Caution: if you use these defines elsewhere, you'll want to add more parentheses. */
#define MTemp *(Point *)0x828
#define RawMouse *(Point *)0x82C
#define CrsrNew *(Byte *)0x8CE
#define CrsrCouple *(Byte *)0x8CF
void SetMouse(Point where)
{
LocalToGlobal(&where); /* Convert point to global coordinates */
/* Quoting from the Q & A Stack: "If you wish to place the cursor in an */
/* absolute location on the screen, you must set RawMouse, and MTemp to */
/* the same value, and set CrsrNew to the same value as CrsrCouple." */
MTemp=RawMouse=where;
CrsrNew=CrsrCouple;
}